package com.santoker.baseservice.constant;

/**
 * 全局常量
 *
 * @author jiangs
 */
public class GlobalConstant {

    public static final String TOKEN_PREFIX = "tokenPrefix";
    public static final long accessTokenTimeout = 7l;

    public static final String TOKEN_PARAM = "_token";
    public static final String CURRENT_USER_INFO = "CURRENT_USER_INFO";
    public static final String API_START_TIME = "API_START_TIME";

    public static final long CODE_VALID_DURATION = 300;
    public static final long CODE_SEND_GAP = 60;

    /**
     * 校验邮箱正则
     */
    public static final String EMAIL_REGEX = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";

    /**
     * 校验登录密码正则
     */
    public static final String PWD_REGEX = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$";

    /**
     * 校验用户昵称正则
     */
    public static final String NICKNAME_REGEX = "^([a-zA-Z]|[\\u4E00-\\u9FA5])([-_a-zA-Z0-9]|[\\u4E00-\\u9FA5]){1,19}$";

    /**
     * 校验手机号码正则
     */
    public static final String MOBILE_REGEX = "(\\+\\d+)?1[0-9]\\d{9}$";

    /**
     * 日期 yyyy-MM-dd 正则
     */
    public static final String YYYY_MM_DD_REGEX = "^\\d{4}(\\-)\\d{1,2}\\1\\d{1,2}$";

    /**
     * 图片上传配置
     */
    public static long IMG_MAX_SIZE = 1024 * 1024 * 30;
    public static String IMG_MAX_SIZE_NAME = "30M";
    public static String[] IMG_TYPE = {"image/jpg", "image/jpeg", "image/png", "image/gif"};

    /**
     * mybatis plus 条件构造器 拼接在最后的SQL语句
     */
    public static final String WRAPPER_LAST_SQL = "LIMIT 1";

}
